from flask import Blueprint, render_template, session, redirect, url_for,send_from_directory

main_bp = Blueprint('main', __name__)


@main_bp.route('/')
def index():
    if 'user_id' not in session:
        return redirect(url_for('auth.login'))
    return render_template('index.html', username=session['username'])

@main_bp.route('/<path:path>')
def serve_static(path):
    return send_from_directory('static', path)


